package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.product.SkuInfo;
import com.atguigu.gmall.product.client.ProductFeignClient;
import org.checkerframework.checker.guieffect.qual.UI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
@SuppressWarnings("all")
public class CartController {

    @Autowired
    private ProductFeignClient productFeignClient;

    /**
     * 购物车列表
     * @return
     */
    @GetMapping("/cart.html")
    public String index(){


        return "cart/index";
    }



    @GetMapping("/addCart.html")
    public String toAddCart(Long skuId, Integer skuNum, Model model){

        //获取skuInfo
        SkuInfo skuInfo = productFeignClient.getSkuInfo(skuId);
        model.addAttribute("skuInfo",skuInfo);
        model.addAttribute("skuNum",skuNum);


        return "cart/addCart";
    }
}
